home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / misc / o-z / x-windows / gs262 / gdebug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-29  |  3.3 KB  |  89 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gdebug.h */
  20. /* Debugging machinery for Ghostscript */
  21.  
  22. /* Debugging options array */
  23. #ifndef AMIGA
  24. extern char gs_debug[128];
  25. #else
  26. extern unsigned char gs_debug[128];
  27. #endif
  28. /* If debugging, direct all error output to gs_debug_out. */
  29. #ifdef DEBUG
  30. extern FILE *gs_debug_out;
  31. #undef dstderr
  32. #define dstderr gs_debug_out
  33. #undef estderr
  34. #define estderr gs_debug_out
  35. #endif
  36.  
  37. /* Insert code conditionally if debugging. */
  38. #ifdef DEBUG
  39. #  define do_debug(x) x
  40. #else
  41. #  define do_debug(x)
  42. #endif
  43.  
  44. /* Debugging printout macros. */
  45. #ifdef DEBUG
  46. #  define debug_c(c)\
  47.     (c>='a' && c<='z' ? gs_debug[c] | gs_debug[c^32] : gs_debug[c])
  48. #  define if_debug0(c,s)\
  49.     if (debug_c(c)) dprintf(s)
  50. #  define if_debug1(c,s,a1)\
  51.     if (debug_c(c)) dprintf1(s,a1)
  52. #  define if_debug2(c,s,a1,a2)\
  53.     if (debug_c(c)) dprintf2(s,a1,a2)
  54. #  define if_debug3(c,s,a1,a2,a3)\
  55.     if (debug_c(c)) dprintf3(s,a1,a2,a3)
  56. #  define if_debug4(c,s,a1,a2,a3,a4)\
  57.     if (debug_c(c)) dprintf4(s,a1,a2,a3,a4)
  58. #  define if_debug5(c,s,a1,a2,a3,a4,a5)\
  59.     if (debug_c(c)) dprintf5(s,a1,a2,a3,a4,a5)
  60. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6)\
  61.     if (debug_c(c)) dprintf6(s,a1,a2,a3,a4,a5,a6)
  62. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7)\
  63.     if (debug_c(c)) dprintf7(s,a1,a2,a3,a4,a5,a6,a7)
  64. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8)\
  65.     if (debug_c(c)) dprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8)
  66. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)\
  67.     if (debug_c(c)) dprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
  68. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)\
  69.     if (debug_c(c)) dprintf10(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
  70. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)\
  71.     if (debug_c(c)) dprintf11(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
  72. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)\
  73.     if (debug_c(c)) dprintf12(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
  74. #else
  75. #  define if_debug0(c,s) 0
  76. #  define if_debug1(c,s,a1) 0
  77. #  define if_debug2(c,s,a1,a2) 0
  78. #  define if_debug3(c,s,a1,a2,a3) 0
  79. #  define if_debug4(c,s,a1,a2,a3,a4) 0
  80. #  define if_debug5(c,s,a1,a2,a3,a4,a5) 0
  81. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6) 0
  82. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7) 0
  83. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8) 0
  84. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9) 0
  85. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) 0
  86. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) 0
  87. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) 0
  88. #endif
  89.